package cn.wolfcode.wolf2w.util;

import cn.wolfcode.wolf2w.exception.LogicException;
import org.springframework.util.StringUtils;

/**
 * 参数断言工具类
 */
public class AssertUtil {

    /**
     * @param value 传进来的用户数据
     * @param msg
     */
    public static void hasLength(String value,String msg){
        //判断用户传入数据是否有值
        if(!StringUtils.hasLength(value)){
            throw new LogicException(msg);
        }
    }

    public static void isEquals(String password, String rpassword,String msg) {
        if(password ==null || rpassword==null){
            throw new LogicException("密码不能为空");
        }
        if(!password.equals(rpassword)){
            throw new LogicException(msg);
        }
    }
}
